package cn.tom.service.impl;

import cn.tom.entity.XUser;
import cn.tom.dao.UserDao;
import cn.tom.service.SmsService;
import cn.tom.tools.CodeUtil;
import cn.tom.tools.SmsUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @author 酒辞
 */

@Service
public class SmsServiceImpl implements SmsService {
    final RedisTemplate redisTemplate;


    public SmsServiceImpl(StringRedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;

    }
    @Override
    public boolean smsVerifyCode(String phone) {
//        ValueOperations<String, String> ops = redisTemplate.opsForValue();
//            String code = CodeUtil.getCode();
//            ops.set(phone,code,300, TimeUnit.SECONDS);
//            return SmsUtil.sendMessage(phone, code);
        return true;
    }
}
